<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>查看信息</title>
<script type="text/javascript">
function checkForm(){
	if(searchform.viewValue.value == ""){
		alert("请填写搜索内容");
		return false;
	}
	else if(searchform.viewKey.value == -1){
		alert("请选择搜索类别");
		return false;
	}
	
//	if(selectInfo.inputvalue.value == "")
//	{
//		alert("请填写搜索内容");
//		return false;
//	}
//	else if(selectInfo.selectProperty.value == "default"){
//		alert("请选择搜索类别");
//		return false;
//	}
//	selectInfo.hiddenkey.value = selectInfo.selectProperty.value;
//	selectInfo.hiddenvalue.value = selectInfo.inputvalue.value;
}
</script>
</head>
<body>
<table width="100%" height="100%">
<tr>
	<td valign="top">
		<s:if test="%{role==0}">
			<jsp:include page="../readhead.jsp"/>
		</s:if>
		<s:elseif test="%{role==1}">
			<jsp:include page="../writehead.jsp"/>
		</s:elseif>
		<s:elseif test="%{role==2}">
			<jsp:include page="../head.jsp"/>
		</s:elseif>
	</td>
</tr>
</table>

<h2>搜索用户信息</h2>
<div id="search">
<s:form id="searchform" method="post" onsubmit="return checkForm();">
	<s:textfield id="viewValue" name="viewValue" label="请输入搜索的关键字"/>
	<s:select id="viewKey" name="viewKey" headerKey="-1" headerValue="------请选择搜索类别------"  list="allViewMap"/>
	
	<!--<s:iterator value="allViewMap" status="status">
		<s:hidden value="%{top.key}" name="%{'allViewList['+#status.index+'].pname'}"/>
		<s:hidden value="%{top.value}" name="%{'allViewList['+#status.index+'].value'}"/>
	</s:iterator>-->
	
	<s:submit value="搜索" action="searchInfoAction"/>
    <s:submit value="导出Excel" action="dlsearchInfoAction"/>	
</s:form>
</div>
 
<div id="selectcolumn">
<s:form id="selectcolumn" method="post">
<h2>查看所有用户信息</h2>
	请选择要查看的列名
	<s:iterator value="allViewList" status="status">
		<s:checkbox label="%{pname}" name="%{'allViewList['+#status.index+'].cname'}"/>
		<s:hidden value="%{pname}" name="%{'allViewList['+#status.index+'].pname'}"/>
		<s:hidden value="%{value}" name="%{'allViewList['+#status.index+'].value'}"/>
		<!-- value里边有@的是灵活数据，没有@的是固定数据，在后边根据@区分 -->
	</s:iterator>
	<!--这是一种方法 <input type="hidden" id="whickfunc" name="whichKey" value="1"/>
    <s:submit value="查看" onclick="document.getElementById('whickfunc').value = '2';document.getElementById('selectcolumn').submit();"/> 
    <s:submit value="导出Excel" onclick="document.getElementById('whickfunc').value = '1';document.getElementById('selectcolumn').submit();"/> -->
    <s:submit value="查看" action="showInfoAction"/>
    <s:submit value="导出Excel" action="downloadInfoAction"/>
</s:form>
</div>

</body>
</html>